package com.jymj.entity.landmanage;

import com.fasterxml.jackson.annotation.JsonFormat;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Date;
import java.util.List;

/**
 * Created by ${lc} on 2020/12/14. 按月查询分数
 */
public class ScoreMonEntity {
    private String xzqmc;
    private String code;
    private String zhen;
    private String zhencode;
    private BigDecimal average;//均分
    private Integer score;//分数
    private Integer counts;//数量
    @JsonFormat(pattern = "yyyy-MM", timezone = "GMT+8")
    private Date jldate;
    private List<ScoreMonEntity> scoreMons;

    public Integer getCounts() {
        return counts == null ? 0 : counts;
    }

    public void setCounts(Integer counts) {
        this.counts = counts;
    }

    public List<ScoreMonEntity> getScoreMons() {
        return scoreMons;
    }

    public void setScoreMons(List<ScoreMonEntity> scoreMons) {
        this.scoreMons = scoreMons;
    }

    public String getXzqmc() {
        return xzqmc;
    }

    public void setXzqmc(String xzqmc) {
        this.xzqmc = xzqmc;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getZhen() {
        return zhen;
    }

    public void setZhen(String zhen) {
        this.zhen = zhen;
    }

    public String getZhencode() {
        return zhencode;
    }

    public void setZhencode(String zhencode) {
        this.zhencode = zhencode;
    }

    public BigDecimal getAverage() {
        return getCounts() == 0 ? BigDecimal.ZERO : (getScore() == 0 ? BigDecimal.ZERO :
        BigDecimal.valueOf(getScore()).divide(BigDecimal.valueOf(getCounts()),1,RoundingMode.HALF_UP));
    }

    public Integer getScore() {
        return score == null ? 0 : score;
    }

    public void setScore(Integer score) {
        this.score = score;
    }

    public Date getJldate() {
        return jldate;
    }

    public void setJldate(Date jldate) {
        this.jldate = jldate;
    }
}
